feat(modal): expose snapBreakpoint on swipe-to-close modals#31002
feat(modal): expose snapBreakpoint on swipe-to-close modals#31002aeharding wants to merge 1 commit into
Conversation
|
@aeharding is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
e9f92a4 to
c200d78
Compare
| deltaY: detail.deltaY, | ||
| velocityY: detail.velocityY, | ||
| progress: calculateProgress(el, detail.deltaY), | ||
| snapBreakpoint: shouldComplete ? 0 : 1, |
There was a problem hiding this comment.
snapBreakpoint is specific to sheet modals, and card modals have no breakpoint concept, so exposing a "breakpoint" here is a bit misleading. Let's call it isDismissing and return a plain boolean instead of 0/1.
| snapBreakpoint: shouldComplete ? 0 : 1, | |
| isDismissing: shouldComplete, |
This also follows the convention we use for other booleans on public event details, such as isScrolling on ion-content's ScrollDetail and isAnimating on the menu interface.
One more change to go with it: please add the field to ModalDragEventDetail in modal-interface.ts so it's part of the public type:
/**
* Whether the card modal will dismiss when the drag gesture ends.
* `true` if the gesture passed the dismiss threshold, `false` if the
* modal will remain open.
*/
isDismissing?: boolean;There was a problem hiding this comment.
Adding this variable changes the ionDragEnd detail length, so the existing assertion in modal-card.e2e.ts will fail. Please update the expected length there.
Issue number: resolves #31001
What is the current behavior?
No
snapBreakpointWhat is the new behavior?
Expose
snapBreakpointonionDragEndevent forswipe-to-closedialogs.Does this introduce a breaking change?
Other information
Testing with Voyager and works great! aeharding/voyager#2227